.el-menu {
  .el-submenu__title {
    @include themify() {
      color: themed("menuText");
    }
  }

  @include themify() {
    background-color: themed("menuBg");
  }

  .el-menu-item {
    @include themify() {
      color: themed("menuText");
    }
  }

  .el-menu-item.is-active {
    @include themify() {
      color: themed("menuActiveText");
      background-color: themed("menuHover") !important;
    }
  }

  .el-menu-item:focus {
    @include themify() {
      background-color: themed("menuHover");
    }
  }
}

#app {
  .sidebar-container {
    ::-webkit-scrollbar-thumb {
      right: 10px;
    }

    width: 200px !important;
    height: 100%;
    padding-bottom: 60px;
    position: absolute;
    left: 0;
    right: 0;
    z-index: 2;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.3, 0, 0.86, 0.57);
    @include themify() {
      background-color: themed("menuBg");
      box-shadow: 0 15px 30px themed("navBarShadow");
    }

    // reset element-ui css
    .nest-menu {
      .el-submenu {
        .el-submenu__title {
          span {
            margin-left: 12px;
          }
        }
      }

      .el-menu-item {
        span {
          margin-left: 12px;
        }
      }
    }

    .horizontal-collapse-transition {
      transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
    }

    .scrollbar-wrapper {
      overflow-x: hidden !important;
    }

    .el-scrollbar__bar.is-vertical {
      right: 0px;
      width: 7px;
    }

    .is-horizontal {
      display: none;
    }

    a {
      display: inline-block;
      width: 100%;
      overflow: hidden;
    }

    .svg-icon {
      margin-right: 14px;
    }

    .el-menu {
      border: none;
      height: 100%;
      width: 100% !important;

      .el-submenu__title {
        transition-timing-function: cubic-bezier(0.3, 0, 0.86, 0.57) !important;

        &:hover {
          transition-timing-function: cubic-bezier(0.3, 0, 0.86, 0.57) !important;
        }
      }

      .el-menu-item {
        padding-right: 20px !important;
        transition-timing-function: cubic-bezier(0.3, 0, 0.86, 0.57) !important;

        &:hover {
          transition-timing-function: cubic-bezier(0.3, 0, 0.86, 0.57) !important;
        }
      }
    }

    // submen
    .nest-menu {
      // background-color: $subMenuBg;
      @include themify() {
        background-color: themed("subMenuBg");
      }
    }

    .el-submenu__icon-arrow {
      // color: $menuText;
      @include themify() {
        color: themed("menuText");
      }
    }

    // menu hover
    .submenu-title-noDropdown,
    .el-submenu__title {
      &:hover {
        @include themify() {
          background-color: themed("menuHover");
        }
      }
    }

    .is-active > .el-submenu__title {
      @include themify() {
        color: themed("subMenuActiveText");
      }
    }

    & .nest-menu .el-submenu > .el-submenu__title,
    & .el-submenu .el-menu-item {
      min-width: 64px !important;
      @include themify() {
        background-color: themed("subMenuBg");
      }

      &:hover {
        @include themify() {
          background-color: themed("subMenuHover");
        }
      }
    }

    .el-menu--collapse .el-menu .el-submenu {
      min-width: 64px !important;
    }
  }

  .hideSidebar {
    .main-container {
      width: calc(100% - 64px);
      margin-left: 64px;
    }

    .sidebar-container {
      width: 64px !important;

      .submenu-title-noDropdown {
        padding: 0 !important;
        position: relative;

        .el-tooltip {
          padding: 0 !important;

          .svg-icon {
            margin-left: 20px;
          }
        }
      }

      .el-submenu {
        overflow: hidden;

        & > .el-submenu__title {
          padding: 0 !important;

          .svg-icon {
            margin-left: 20px;
          }

          .el-submenu__icon-arrow {
            display: none;
          }
        }
      }

      .el-menu--collapse {
        .el-submenu {
          & > .el-submenu__title {
            & > span {
              height: 0;
              width: 0;
              overflow: hidden;
              visibility: hidden;
              display: inline-block;
            }
          }
        }
      }
    }
  }

  // mobile responsive
  .mobile {
    .main-container {
      margin-left: 0px;
    }

    .sidebar-container {
      transition: transform 0.28s;
      width: 64px !important;
    }

    &.hideSidebar {
      .sidebar-container {
        pointer-events: none;
        transition-duration: 0.3s;
        transform: translate3d(-64px, 0, 0);
      }
    }
  }

  .withoutAnimation {
    .main-container,
    .sidebar-container {
      transition: none;
    }
  }
}

// when menu collapsed
.el-menu--vertical {
  & > .el-menu {
    .svg-icon {
      margin-right: 16px;
    }
  }

  .nest-menu .el-submenu > .el-submenu__title,
  .el-menu-item {
    &:hover {
      @include themify() {
        background-color: themed("menuHover");
      }
    }
  }

  // the scroll bar appears when the subMenu is too long
  > .el-menu--popup {
    max-height: 100vh;
    overflow-y: auto;

    &::-webkit-scrollbar-track-piece {
      background: #d3dce6;
    }

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background: #99a9bf;
      border-radius: 20px;
    }
  }
}
